import 'package:bxultimate/app/router/router_name.dart';
import 'package:bxultimate/app/theme/app_theme.dart';
import 'package:bxultimate/widgets/mk_card_container.dart';
import 'package:bxultimate/widgets/mk_list_cell_item.dart';
import 'package:bxultimate/widgets/mk_page.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:tdesign_flutter/tdesign_flutter.dart';

import 'controller.dart';

class UserPrivacyIndexPage extends StatefulWidget {
  const UserPrivacyIndexPage({Key? key}) : super(key: key);

  @override
  State<UserPrivacyIndexPage> createState() => _UserPrivacyIndexPageState();
}

class _UserPrivacyIndexPageState extends State<UserPrivacyIndexPage> {
  final controller = Get.find<UserPrivacyIndexController>();
  final state = Get.find<UserPrivacyIndexController>().state;

  @override
  Widget build(BuildContext context) {
    return MkPage(
        child: Scaffold(
      backgroundColor: Colors.transparent,
      appBar: TDNavBar(
        backgroundColor: Colors.transparent,
        title: '隐私设置',
      ),
      body: Column(
        children: [_buildNav()],
      ),
    ));
  }

  _buildNav() {
    return MkCardContainer(
      padding: EdgeInsets.symmetric(horizontal: AppTheme.iDefaultPadding / 2),
      margin: EdgeInsets.symmetric(
          horizontal: AppTheme.iDefaultPadding,
          vertical: AppTheme.iDefaultPadding / 2),
      borderRadius: AppTheme.iBorderRadius,
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          TDCell(
            title: '个人信息收集设置',
            description: '管理个人信息收集权限和系统数据访问权限',
            arrow: true,
            onClick: (TDCell e) {
              Get.toNamed(RouterName.userPrivacyPermission);
            },
          ),
          TDCell(
            title: '个人信息下载',
            arrow: true,
            onClick: (TDCell e) {
              Get.toNamed(RouterName.userPrivacyDownloadInfo);
            },
          ),
          TDCell(
            title: '个性化推荐设置',
            arrow: true,
            onClick: (TDCell e) {
              Get.toNamed(RouterName.userPrivacyRecommend);
            },
          ),
          TDCell(
            title: '应用权限说明',
            arrow: true,
            onClick: (TDCell e) {
              Get.toNamed(RouterName.userPrivacyAppPermission);
            },
          ),
          TDCell(
            title: '个人信息收集清单',
            arrow: true,
            onClick: (TDCell e) {
              Get.toNamed(RouterName.userPrivacyCollectInfo);
            },
          ),
          TDCell(
            title: '第三方信息共享清单',
            arrow: true,
            onClick: (TDCell e) {
              Get.toNamed(RouterName.userPrivacyOtherInfo);
            },
          ),
          TDCell(
            title: '用户协议',
            arrow: true,
            onClick: (TDCell e) {
              Get.toNamed(RouterName.userSystemSettingUserAgreement);
            },
          ),
          TDCell(
            title: '隐私政策',
            arrow: true,
            onClick: (TDCell e) {
              Get.toNamed(RouterName.userSystemSettingPrivacy);
            },
          ),
        ],
      ),
    );
  }

  @override
  void dispose() {
    Get.delete<UserPrivacyIndexController>();
    super.dispose();
  }
}
